package com.sun.dream.fish.controller;

import com.sun.dream.fish.service.ILoginService;
import com.sun.dream.fish.vo.ResultVO;
import com.sun.dream.fish.vo.back.LoginUserVO;
import com.sun.dream.fish.vo.back.RegisterVO;
import com.sun.dream.fish.vo.back.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Description: 登录接口
 * Created By ljl on 2023/12/11.
 */
@RestController
@RequestMapping("/auth")
public class LoginController {
    @Autowired
    ILoginService loginService;


    @PostMapping("/login")
    public ResultVO<LoginUserVO> login(@RequestParam("username") String username, @RequestParam("password") String password) {
        return loginService.login(username, password);
    }

    @PostMapping("/logout")
    public ResultVO<LoginUserVO> logout() {
        return loginService.logout();
    }

    @PostMapping("/register")
    public ResultVO register(@RequestBody RegisterVO registerVO) {
        return loginService.register(registerVO);
    }
}
